<?php //echo $this->navigation($this->container)->menu()->setUlClass("navigation-1");     ?>

<script type="text/javascript">
    ddsmoothmenu.init({
        mainmenuid: "smoothmenu1", //menu DIV id
        orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v"
        classname: 'ddsmoothmenu', //class added to menu's outer DIV
        //customtheme: ["#1c5a80", "#18374a"],
        contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
    })
</script>
<div id="smoothmenu1" class="float_left">
    <ul id="navigation-1">
        <?php
        $url = St_Registry::getConfig("base_url");
        $url = $url.'admin/';
        $action = St_Registry::getActionName();
        $action = $action == 'index' ? '' : $action;
        $controller = St_Registry::getControllerName();
        $menus = include APPLICATION_PATH . '/configs/menu.php';
        if ($_SESSION['userSchool'] != '') {
            $menus = $menus['Admin'];
        } else {
            $menus = $menus['Master'];
        }
        foreach ($menus as $key1 => $menu) {
            $sub_html = "";
            $current = "";
            if ($action == $menu['action'] && $controller == $menu['controller']) {
                $current = 'class="current"';
            }
            if (is_array($menu['pages']) && count($menu['pages'])) {
                $sub_html = "<ul class='navigation-2'>";
                foreach ($menu['pages'] as $submenu) {
                    $sub_html1 = "";
                    $dir = "";
                    $sub_current = "";
                    if ($action == $submenu['action'] && $controller == $submenu['controller']) {
                        $sub_current = 'current';
                        $current = 'class="current"';
                    }
                    if (is_array($submenu['pages']) && count($submenu['pages'])) {
                        $sub_html1 = "<ul class='navigation-3'>";
                        foreach ($submenu['pages'] as $submenu1) {
                            $sub_current1 = "";
                            if ($action == $submenu1['action'] && $controller == $submenu1['controller']) {
                                $sub_current1 = 'class="current"';
                                $sub_current = 'current';
                                $current = 'class="current"';
                            }
                            $sub_html1 .= "
                            <li $sub_current1>
                                <a href=\"{$url}{$submenu1['controller']}/{$submenu1['action']}\">
                                {$submenu1['label']}
                                </a>
                            </li>
                        ";
                        }
                        $sub_html1 .= "</ul>";
                        $dir = 'dir';
                    }
                    $sub_html .= "
                    <li class='$sub_current $dir' >
                        <a href=\"{$url}{$submenu['controller']}/{$submenu['action']}\">
                        {$submenu['label']}
                        </a>
                        $sub_html1
                    </li>";
                }
                $sub_html .= "</ul>";
            }
            echo "
            <li $current>
                <a href=\"{$url}{$menu['controller']}/{$menu['action']}\">
                <span>{$menu['label']}</span>
                </a>
                $sub_html
            </li>";
        }
        ?>
    </ul>
</div>